#include<iostream>
#include<vector>
using namespace std;

int main()
{
    int n;
    char c;
    cin >> c >> n;
    getchar();
    vector<vector<char>> str(n, vector<char>(n));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cin >> str[i][j];
        }
        getchar();
    }
    int flag = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (str[i][j] != str[n - 1 - i][n - 1 - j])
                flag = 0;
        }
    }
    if (flag == 1)
        cout << "bu yong dao le" << endl;
    for (int i = n - 1; i >= 0; i--)
    {
        for (int j = n - 1; j >= 0; j--)
        {
            if (str[i][j] != ' ')
                cout << c;
            else
                cout << " ";
        }
        cout << endl;
    }
    return 0;
}